package com.ymatou.apigateway.testcase;

import java.math.BigDecimal;

import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.shenqisettlement.parameter.bean.AgentProductBean;
import com.shop2cn.iapi.sqoptrade.resp.TradingServiceResp;
import com.ymatou.apigateway.parameter.AesUtil;
import com.ymatou.apigateway.parameter.OpenSqAcceptorderReq;
import com.ymatou.apigateway.parameter.OpenapiReq;
import com.ymatou.apigateway.service.OpenapiService;
import com.ymatou.apigateway.service.V1getorderCall;
import com.ymatou.iapi.synctrade.service.TradingSyncService;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.SQPayGateWayCallService;
import com.ymttest.business.service.shenqi.DGSQBuildProxyChainCallService;
import com.ymttest.business.service.shenqi.SqTradingCallService;
import com.ymttest.database.model.Application;
import com.ymttest.database.model.AuthCode;
import com.ymttest.database.sharding.db.sharding.model.OrderPo;
import com.ymttest.database.sharding.db.sqlwapper.OrderShardingWapper;
import com.ymttest.database.sqlwapper.OpenApiWapper;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * openapi批量接单FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_sqAcceptOrder {
	
	private static OpenapiReq openapiReq;
	private static V1getorderCall v1getorderlistCall;
	private static OpenApiWapper openApiWapper;
	private static OpenSqAcceptorderReq openAcceptorderReq;
	
	private static OrderShardingWapper orderShardingWapper = new OrderShardingWapper();
	
	private static long autotest_goodsOwnerId = Long.valueOf(EnvSetup
			.getData("autotest_goodsOwnerId"));

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("openapi神器批量接单");
		openApiWapper = new OpenApiWapper();

	}

	@Before
	public void caseUp() {
		
		openapiReq = new OpenapiReq();
		openAcceptorderReq = new OpenSqAcceptorderReq();
		v1getorderlistCall = new V1getorderCall();
		openapiReq.setMethod("sq.order.accept");
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(v1getorderlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_001() {
		Logger.start(true, "openapi批量接单");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);
			TradingServiceResp placeOrderResp = SqTradingCallService
					.placeOrder(productBean);

			Long userId = placeOrderResp.getUserId();
			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();
			BigDecimal totalPrice = placeOrderResp.getPayableAmount();

			// 支付订单
			Long thirdTradingId = SqTradingCallService.payOrder(userId,
					placeOrderResp.getTradingId());

			// 支付网关支付回调交易
			SQPayGateWayCallService.DGSQNotifyCall(
					String.valueOf(thirdTradingId),
					totalPrice.subtract(BigDecimal.ZERO).toString(),
					userId.intValue(), BigDecimal.ZERO.toPlainString());
			
			Thread.sleep(5000);

			openAcceptorderReq.setOrder_ids(new Long[]{(long) orderId});

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(autotest_goodsOwnerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("", v1getorderlistCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(v1getorderlistCall.getContent(), "校验content");
			
			OrderPo orderPo = orderShardingWapper.selectOrderbyOrderId(orderId);
			
			Logger.verifyEquals(17, orderPo.getOrderStatus(), "验证orderStatus");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_002() {
		Logger.start(true, "openapi批量接单,该订单不是买手的订单");
		try {

			openAcceptorderReq.setOrder_ids(new Long[]{1420059305L});

			Application application = openApiWapper
					.selectApplicationBySellerId(3383L).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));
			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");

			DataUtil.verify(
					String.format("用户%s不是订单%s的所有者", 3383,
							openAcceptorderReq.getorder_ids()[0]),
					v1getorderlistCall.getResults().getJSONObject(0).get("msg"),
					"校验msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	// 没有区分是否神器订单
	public void Tc_v1acceptorder_003() {
		Logger.start(true, "openapi批量接单,非神器订单");
		try {

			openAcceptorderReq.setOrder_ids(new Long[]{10482288699L});

			Application application = openApiWapper
					.selectApplicationBySellerId(24635724L).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));
			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("null", v1getorderlistCall.getMsg(),
					"校验message");

			DataUtil.verify(String.format("订单号%s不存在",
					openAcceptorderReq.getorder_ids()[0]), v1getorderlistCall
					.getResults().getJSONObject(0).get("msg"), "校验msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_004() {
		Logger.start(true, "openapi批量接单,订单号为null");
		try {

			Application application = openApiWapper
					.selectApplicationBySellerId(3383L).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));
			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0001", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("orderIds:orderIds未提供",
					v1getorderlistCall.getMsg(), "校验message");

			Logger.verifyIsNull(v1getorderlistCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_005() {
		Logger.start(true, "openapi批量接单,订单为已接单");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			TradingServiceResp placeOrderResp = SqTradingCallService
					.placeOrder(productBean);

			Long userId = placeOrderResp.getUserId();
			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();
			BigDecimal totalPrice = placeOrderResp.getPayableAmount();

			// 支付订单
			Long thirdTradingId = SqTradingCallService.payOrder(userId,
					placeOrderResp.getTradingId());

			// 支付网关支付回调交易
			SQPayGateWayCallService.DGSQNotifyCall(
					String.valueOf(thirdTradingId),
					totalPrice.subtract(BigDecimal.ZERO).toString(),
					userId.intValue(), BigDecimal.ZERO.toPlainString());
			
			Thread.sleep(5000);
			
			// 接单
			SqTradingCallService
					.sellerAcceptOrder(autotest_goodsOwnerId, orderId);
			TradingSyncService.getSyncResult(orderId);

			openAcceptorderReq.setOrder_ids(new Long[]{(long) orderId});

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(autotest_goodsOwnerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));
			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals(null, v1getorderlistCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(v1getorderlistCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_007() {
		Logger.start(true, "openapi批量接单");
		try {
			
			Long[] array = new Long[2];
			
			for (int i = 0; i < 2; i++) {
				
				AgentProductBean productBean = DGSQBuildProxyChainCallService
						.createProxychain((int) autotest_goodsOwnerId, 0, false);
				TradingServiceResp placeOrderResp = SqTradingCallService
						.placeOrder(productBean);

				Long userId = placeOrderResp.getUserId();
				long orderId = placeOrderResp.getOrderList().get(0).getOrderId();
				BigDecimal totalPrice = placeOrderResp.getPayableAmount();

				// 支付订单
				Long thirdTradingId = SqTradingCallService.payOrder(userId,
						placeOrderResp.getTradingId());

				// 支付网关支付回调交易
				SQPayGateWayCallService.DGSQNotifyCall(
						String.valueOf(thirdTradingId),
						totalPrice.subtract(BigDecimal.ZERO).toString(),
						userId.intValue(), BigDecimal.ZERO.toPlainString());
				
				Thread.sleep(5000);
				
				array[i] = orderId;
			}

			openAcceptorderReq.setOrder_ids(array);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(autotest_goodsOwnerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("", v1getorderlistCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(v1getorderlistCall.getContent(), "校验content");
			
			for (Long orderId : array) {
				
				OrderPo orderPo = orderShardingWapper.selectOrderbyOrderId(orderId);
				
				Logger.verifyEquals(17, orderPo.getOrderStatus(), "验证orderStatus");
			}

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_008() {
		Logger.start(true, "openapi批量接单,同一个订单传多次");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			TradingServiceResp placeOrderResp = SqTradingCallService
					.placeOrder(productBean);

			Long userId = placeOrderResp.getUserId();
			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();
			BigDecimal totalPrice = placeOrderResp.getPayableAmount();

			// 支付订单
			Long thirdTradingId = SqTradingCallService.payOrder(userId,
					placeOrderResp.getTradingId());

			// 支付网关支付回调交易
			SQPayGateWayCallService.DGSQNotifyCall(
					String.valueOf(thirdTradingId),
					totalPrice.subtract(BigDecimal.ZERO).toString(),
					userId.intValue(), BigDecimal.ZERO.toPlainString());
			
			Thread.sleep(5000);

			openAcceptorderReq.setOrder_ids(new Long[]{(long) orderId,
					(long) orderId});

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(autotest_goodsOwnerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("", v1getorderlistCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(v1getorderlistCall.getContent(), "校验content");

			OrderPo orderPo = orderShardingWapper.selectOrderbyOrderId(orderId);
			
			Logger.verifyEquals(17, orderPo.getOrderStatus(), "验证orderStatus");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_009() {
		Logger.start(true, "openapi批量接单,订单状态为不能接单");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			TradingServiceResp placeOrderResp = SqTradingCallService
					.placeOrder(productBean);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			openAcceptorderReq.setOrder_ids(new Long[]{(long) orderId});

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(autotest_goodsOwnerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("", v1getorderlistCall.getMsg(),
					"校验message");

			for (int i = 0; i < v1getorderlistCall.getResults().length(); i++) {

				JSONObject json = v1getorderlistCall.getResults()
						.getJSONObject(i);

				DataUtil.verify(String.format("当前订单[%s]状态不能确认接单", orderId), json.get("msg"), "校验msg");

				DataUtil.verify(openAcceptorderReq.getorder_ids()[i],
						json.get("order_id"), "校验order_id");
			}

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_v1acceptorder_010() {

		Logger.start(true, "openapi批量接单,订单组里有不能接单的订单");

		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);
			TradingServiceResp placeOrderResp1 = SqTradingCallService
					.placeOrder(productBean1);

			Long userId = placeOrderResp1.getUserId();
			long orderId1 = placeOrderResp1.getOrderList().get(0).getOrderId();
			BigDecimal totalPrice1 = placeOrderResp1.getPayableAmount();

			// 支付订单
			Long thirdTradingId = SqTradingCallService.payOrder(userId,
					placeOrderResp1.getTradingId());

			// 支付网关支付回调交易
			SQPayGateWayCallService.DGSQNotifyCall(
					String.valueOf(thirdTradingId),
					totalPrice1.subtract(BigDecimal.ZERO).toString(),
					userId.intValue(), BigDecimal.ZERO.toPlainString());
			
			Thread.sleep(5000);
			
			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);
			TradingServiceResp placeOrderResp2 = SqTradingCallService
					.placeOrder(productBean2);
			long orderId2 = placeOrderResp2.getOrderList().get(0).getOrderId();

			openAcceptorderReq.setOrder_ids(new Long[]{(long) orderId1,
					(long) orderId2});

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(autotest_goodsOwnerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("", v1getorderlistCall.getMsg(),
					"校验message");

			for (int i = 1; i < v1getorderlistCall.getResults().length(); i++) {

				JSONObject json = v1getorderlistCall.getResults()
						.getJSONObject(i);
				
				if (json.getLong("order_id") == orderId2) {
					
					DataUtil.verify(
							String.format("当前订单[1420099364]状态不能确认接单", orderId2),
							json.get("msg"), "校验msg");

					DataUtil.verify(openAcceptorderReq.getorder_ids()[i],
							json.get("order_id"), "校验order_id");
				}
			}
			
			OrderPo orderPo = orderShardingWapper.selectOrderbyOrderId(orderId1);
			
			Logger.verifyEquals(17, orderPo.getOrderStatus(), "验证orderStatus");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_v1acceptorder_011() {
		Logger.start(true, "openapi批量接单-stg");
		try {

			String app_id = "6QcDcCtvV3pJknJUEp";
			String app_secret = "95605832511B6C85DB2D0FA9E3ACBB61FE3E1730322EF9CCA09E7ED5E523721461BEC16080D01798E84218559F4A6177";
			String auth_code = "2teKsa6gaiSUwxsACry9hXIaVsTEXqqV";

			//openAcceptorderReq.setOrder_id(123552539);

			openAcceptorderReq.setOrder_ids(new Long[]{(long) 123552539L});

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(auth_code);
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(FormatUtil
					.beanToGSONString(openAcceptorderReq));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=%s",
							app_id, openapiReq.getMethod());

			v1getorderlistCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1getorderlistCall.setData(openapiReq);

			v1getorderlistCall.callService();

			Logger.verifyEquals("0000", v1getorderlistCall.getCode(), "校验code");
			Logger.verifyEquals("null", v1getorderlistCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(v1getorderlistCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}